
Narcissus.policy = (function() {

	function parsePolicy(policy) {
		var ruleSet = {};	
	
		if (policy['domaccess-read'] === 'yes') {
			ruleSet[document.getElementById] = document.getElementById;
			//Add all other DOM read operations
		} else {
			ruleSet[document.getElementById] = function() { return "No DOM read access" };
			//Add all other DOM read operations
		}
	
		if (policy['domaccess-write'] === 'yes') {
			ruleSet[document.write] = document.write;
			//Add all other DOM write operations
		} else {
			ruleSet[document.write] = function() {};
			//Add all other DOM read operations
		}
	
		if (policy['extcomm'] === 'yes') {
			ruleSet[XMLHttpRequest] = XMLHttpRequest;
		} else if (policy['extcomm'] !== undefined && policy['extcomm'] != 'no') {
			//TODO een XHR die enkel voor bepaalde domeinen werkt
		} else {
			ruleSet[XMLHttpRequest] = {open: function(){}, onreadystatechange: function(){}, send: function() {}, readyState: 4, status: 'No external communication allowed", responseText: "No external communication allowed' };
		}
	
		if (policy['cookie-read'] === 'yes') {
			ruleSet[document.cookie] = document.cookie;
		} else {
			ruleSet[document.cookie] = 'No cookie reads allowed';
		}
	}
}());